home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_ORBit.idb / usr / freeware / bin / libIDL-config.z / libIDL-config
Encoding:
Text File  |  1999-07-16  |  2.0 KB  |  110 lines

  1. #! /bin/sh
  2.  
  3. prefix=${ROOT}/usr/freeware
  4. exec_prefix=${prefix}
  5. exec_prefix_set=no
  6.  
  7. usage()
  8. {
  9.     cat <<EOF
  10. Usage: libIDL-config [OPTIONS]
  11. Options:
  12.     [--prefix[=DIR]]
  13.     [--exec-prefix[=DIR]]
  14.     [--version]
  15.     [--libs]
  16.     [--cflags]
  17. EOF
  18.     exit $1
  19. }
  20.  
  21. if test $# -eq 0; then
  22.     usage 1 1>&2
  23. fi
  24.  
  25. while test $# -gt 0; do
  26.   case "$1" in
  27.   -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
  28.   *) optarg= ;;
  29.   esac
  30.  
  31.   case $1 in
  32.     --prefix=*)
  33.       prefix=$optarg
  34.       if test $exec_prefix_set = no ; then
  35.         exec_prefix=$optarg
  36.       fi
  37.       ;;
  38.     --prefix)
  39.       echo_prefix=yes
  40.       ;;
  41.     --exec-prefix=*)
  42.       exec_prefix=$optarg
  43.       exec_prefix_set=yes
  44.       ;;
  45.     --exec-prefix)
  46.       echo_exec_prefix=yes
  47.       ;;
  48.     --version)
  49.       echo 0.6.8
  50.       exit 0
  51.       ;;
  52.     --cflags)
  53.       if test "${prefix}/include" != /usr/include ; then
  54.         includes="-I${prefix}/include"
  55.       fi
  56.       echo_cflags=yes
  57.       ;;
  58.     --libs)
  59.       echo_libs=yes
  60.       ;;
  61.     *)
  62.       usage 1 1>&2
  63.       ;;
  64.   esac
  65.   shift
  66. done
  67.  
  68. all_flags=
  69.  
  70. if test "$echo_prefix" = "yes"; then
  71.     echo $prefix
  72. fi
  73. if test "$echo_exec_prefix" = "yes"; then
  74.     echo $exec_prefix
  75. fi
  76. if test "$echo_cflags" = "yes"; then
  77.     all_flags="$all_flags $includes $cflags `glib-config --cflags`"
  78. fi
  79. if test "$echo_libs" = "yes"; then
  80.     all_flags="$all_flags -L${ROOT}/usr/freeware/${ABILIB-lib32} -lIDL `glib-config --libs`"
  81. fi
  82.  
  83. # Straight out any possible duplicates, but be careful to
  84. # get `-lfoo -lbar -lbaz' for `-lfoo -lbaz -lbar -lbaz'
  85. other_flags=
  86. rev_libs=
  87. for i in $all_flags; do
  88.     case "$i" in
  89.     # a library, save it for later, in reverse order
  90.     -l*) rev_libs="$i $rev_libs" ;;
  91.     *)
  92.     case " $other_flags " in
  93.     *\ $i\ *) ;;                # already there
  94.     *) other_flags="$other_flags $i" ;;    # add it to output
  95.         esac ;;
  96.     esac
  97. done
  98.  
  99. ord_libs=
  100. for i in $rev_libs; do
  101.     case " $ord_libs " in
  102.     *\ $i\ *) ;;            # already there
  103.     *) ord_libs="$i $ord_libs" ;;    # add it to output in reverse order
  104.     esac
  105. done
  106.  
  107. echo $other_flags $ord_libs
  108.  
  109. exit 0
  110.